<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
                "http://www.w3.org/TR/REC-html40/loose.dtd">
<html>
<head>
  <title>Description of imPad</title>
  <meta name="keywords" content="imPad">
  <meta name="description" content="Pad an image along its four boundaries.">
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  <meta name="generator" content="m2html &copy; 2003 Guillaume Flandin">
  <meta name="robots" content="index, follow">
  <link type="text/css" rel="stylesheet" href="../m2html.css">
</head>
<body>
<a name="_top"></a>
<!-- menu.html channels -->
<h1>imPad
</h1>

<h2><a name="_name"></a>PURPOSE <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
<div class="box"><strong>Pad an image along its four boundaries.</strong></div>

<h2><a name="_synopsis"></a>SYNOPSIS <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
<div class="box"><strong>function J = imPad( I, pad, type ) </strong></div>

<h2><a name="_description"></a>DESCRIPTION <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
<div class="fragment"><pre class="comment"> Pad an image along its four boundaries.

 Similar to Matlab's padarray, with the following differences:
  (1) limited to padding along height and width
  (2) input format allows for separate padding along each dimension
  (3) padding values may be negative, in which case performs *cropping*
  (4) optimized (speedup can be significant, esp. for small arrays)

 The amount of padding along each of the four boundaries (referred to as
 T/B/L/R) is determined by the parameter &quot;pad&quot; as follows:
  if(numel(pad)==1): T=B=L=R=pad
  if(numel(pad)==2): T=B=pad(1), L=R=pad(2)
  if(numel(pad)==4): T=pad(1), B=pad(2), L=pad(3), R=pad(4)

 USAGE
  J = imPad( I, pad, type )

 INPUTS
  I      - [hxwxk] input image (single, double or uint8 array)
  pad    - pad or crop amount: 1, 2, or 4 element vector (see above)
  type   - pad value or 'replicate', 'symmetric', 'circular'

 OUTPUTS
  J      - [T+h+B x L+w+R x k] padded image

 EXAMPLE
  I=imread('peppers.png'); pad=[10 20]; type=50;
  tic, J1=imPad(I,pad,type); toc
  tic, J2=padarray(I,pad,type,'both'); toc
  figure(1); im(J1); isequal(J1,J2)

 See also padarray

 Piotr's Computer Vision Matlab Toolbox      Version 3.00
 Copyright 2014 Piotr Dollar.  [pdollar-at-gmail.com]
 Licensed under the Simplified BSD License [see external/bsd.txt]</pre></div>





<!-- Start of Google Analytics Code -->
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
var pageTracker = _gat._getTracker("UA-4884268-1");
pageTracker._initData();
pageTracker._trackPageview();
</script>
<!-- end of Google Analytics Code -->

<hr><address>Generated by <strong><a href="http://www.artefact.tk/software/matlab/m2html/" target="_parent">m2html</a></strong> &copy; 2003</address>
</body>
</html>
